package net.wy.commons.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 12-10-15
 * Time: 上午10:48
 * To change this template use File | Settings | File Templates.
 */
public class WebContextService implements IWebContext {
    private HttpServletRequest request;
    private HttpServletResponse response;

    public HttpServletRequest getRequest() {
        return this.request;
    }

    public HttpServletResponse getResponse() {
        return this.response;
    }

    public String getBasePath() {
        return request.getScheme()+"://"+request.getServerName()+(request.getServerPort()==80 ? "" : ":"+request.getServerPort())+request.getContextPath();
    }

    public String getContentPath() {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    public void setRequest(HttpServletRequest request) {
        this.request = request;
    }

    public void setResponse(HttpServletResponse response) {
        this.response = response;
    }
}
